{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0812967d-3dd5-4989-83c5-655acf443b9c",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'pyqtgraph'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[0;32m/tmp/ipykernel_522/1926272583.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpywt\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpyqtgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mQt\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mQtGui\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      5\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpyqtgraph\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mpg\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'pyqtgraph'"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "\n",
    "import pywt\n",
    "from pyqtgraph.Qt import QtGui\n",
    "import pyqtgraph as pg\n",
    "\n",
    "\n",
    "families = ['db', 'sym', 'coif', 'bior', 'rbio']\n",
    "\n",
    "\n",
    "def main():\n",
    "    app = QtGui.QApplication(sys.argv)\n",
    "    tabs = QtGui.QTabWidget()\n",
    "\n",
    "    for family in families:\n",
    "        scroller = QtGui.QScrollArea()\n",
    "        vb = pg.GraphicsWindow()\n",
    "        vb.setMinimumHeight(3000)\n",
    "        vb.setMinimumWidth(1900)\n",
    "        scroller.setWidget(vb)\n",
    "        for i, name in enumerate(pywt.wavelist(family)):\n",
    "            pen = pg.intColor(i)\n",
    "            wavelet = pywt.Wavelet(name)\n",
    "            if wavelet.orthogonal:\n",
    "                phi, psi, x = wavelet.wavefun(level=5)\n",
    "                ax = vb.addPlot(title=wavelet.name + \" phi\")\n",
    "                ax.plot(phi, pen=pen)\n",
    "                bx = vb.addPlot(title=wavelet.name + \" psi\")\n",
    "                bx.plot(psi, pen=pen)\n",
    "            else:\n",
    "                phi, psi, phi_r, psi_r, x = wavelet.wavefun(level=5)\n",
    "                ax = vb.addPlot(title=wavelet.name + \" phi\")\n",
    "                ax.plot(phi, pen=pen)\n",
    "                bx = vb.addPlot(title=wavelet.name + \" psi\")\n",
    "                bx.plot(psi, pen=pen)\n",
    "                ax = vb.addPlot(title=wavelet.name + \" phi_r\")\n",
    "                ax.plot(phi_r, pen=pen)\n",
    "                bx = vb.addPlot(title=wavelet.name + \" psi_r\")\n",
    "                bx.plot(psi_r, pen=pen)\n",
    "            if i % 2 == 0:\n",
    "                vb.nextRow()\n",
    "        tabs.addTab(scroller, family)\n",
    "\n",
    "    tabs.setWindowTitle('Wavelets')\n",
    "    tabs.resize(1920, 1080)\n",
    "    tabs.show()\n",
    "    sys.exit(app.exec_())\n",
    "\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    main()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e241e3cc-f37c-4679-aa3c-ee56357f606d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
